package com.tang.bloghandle.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.tang.bloghandle.entity.DictEntity;
import com.tang.bloghandle.mapper.DictMapper;
import com.tang.bloghandle.service.IDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * <p>
 * 字典表 服务实现类
 * </p>
 *
 * @author tang.shencai
 * @since 2024-12-04
 */
@Service
public class DictServiceImpl extends ServiceImpl<DictMapper, DictEntity> implements IDictService {

    @Override
    public List<DictEntity> getDictList(String dictCode) {
        if (StringUtils.isNotBlank(dictCode)) {
            return list(new LambdaQueryWrapper<DictEntity>()
                    .eq(DictEntity::getCode,dictCode)
                    .eq(DictEntity::getStatus,0)
                    .orderByAsc(DictEntity::getSort));
        }else return new ArrayList<>();
    }
}
